package cn.com.nes.mybatis.agent.templatedesign.mapper;


import cn.com.nes.mybatis.agent.templatedesign.entity.HHousedesign;
import cn.com.nes.site.entity.vo.design.HHousedesignVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface HHousedesignMapper extends BaseMapper<HHousedesign> {
	//订单池
	List<Map<String, Object>> selectListAsMap(Page<Map<String, Object>> page,@Param("designid") String designid,
	                                          @Param("sbcj") String sbcj, @Param("applytimebefore") String applytimebefore,@Param("applytimeafter") String applytimeafter,
	                                          @Param("dah") String dah,@Param("name") String name,@Param("phone") String phone,
	                                          @Param("status") String status,@Param("cardno") String cardno, @Param("xzqhdm") String xzqhdm,@Param("receivinguser") Long receivinguser,
	@Param("applyuser") Long applyuser,@Param("checkuser") Long checkuser,@Param("toBeReviewed") String toBeReviewed,@Param("showAll") String showAll);
	//	订单详情
	List<Map<String, Object>> orderDetails(@Param("designid") String designid);
	//	接单
	int takeOrders(@Param("receivinguser") Long receivinguser, @Param("designid") String designid);
	//	施工进度查询
	List<Map<String, Object>> progressQueries(Page<Map<String, Object>> page,@Param("hzxm")String hzxm,
	                                          @Param("xzqhdm") String xzqhdm,@Param("lzdh") String lzdh);
	
	//	删除订单
	int deleteOrde(@Param("designid") String designid);
	//	添加订单
	int addOrder(@Param("designid") String designid,@Param("dah") String dah,@Param("name") String name,
	             @Param("cardno") String cardno,@Param("phone") String phone,@Param("memo") String memo,
			@Param("xzqhdm") String xzqhdm,@Param("address") String address,
	             @Param("sbcj") String sbcj,@Param("applyuser") Long applyuser,
	             @Param("sketchfilename") String sketchfilename,@Param("housemodelid") Integer housemodelid ,@Param("sbxh") String sbxh,
	             @Param("sbsgjh_id") Long sbsgjh_id,@Param("companyid") String companyid,@Param("devicedesignpath") String devicedesignpath);

	//	获取行政区划
	List<Map<String, Object>> region(String x);
	//	设备型号
	//todo 暂时没有用到
	List<Map<String, Object>> deviceModel(@Param("sbcj") String sbcj);
	//查找用户名
	String username(Long receivinguser);
	//	设计结果上传
	int outcome(@Param("receivinguser") Long receivinguser,
	            @Param("housedesignfilename") String housedesignfilename, @Param("devicedesignfilename") String devicedesignfilename,@Param("designid")String designid
	,@Param("housedesignCADfilename") String housedesignCADfilename,@Param("housedesignCADfiletxt") String housedesignCADfiletxt);
	//订单审核
	int audit(@Param("checkuser") Long checkuser, @Param("checkresult") String checkresult,
	          @Param("checkmemo") String checkmemo, @Param("designid") String designid,
	          @Param("status") String status);
	@Select("select name sbcjname from nes_ope_prod.is_manufacture_info where manufacture_id = #{sbcj}")
	String getsbcjname(String sbcj);
	//退单
	int chargebacks(String string);
	//===================
	
	/**
	 * 测试用
	 * @param page
	 * @param hHousedesignVo
	 * @return
	 */
	List<HHousedesignVo> ordersList(Page<HHousedesignVo> page,HHousedesignVo hHousedesignVo);
	
	Map<String,Object> getsuperior(String xzqhdm);
	
	String selectdevicemodel(@Param("sbcj") String sbcj, @Param("sbxh") String sbxh);
	@Select("select count(*) from  nes_agent.h_housedesign where  cardno = #{cardno} ")
	int count(String cardno);
}
